﻿using AppSocketModel;
using System.Collections.Generic;

namespace AppSocketService.Relay
{
    /// <summary>
    /// 转发规则接口
    /// </summary>
    public interface IRelayService
    {
        /// <summary>
        /// 添加转发规则(当前账户)
        /// </summary>
        /// <param name="requestDto"></param>
        /// <returns></returns>
        RelayDto Add(RelayRequestDto requestDto);

        /// <summary>
        /// 删除转发规则(当前账户)
        /// </summary>
        /// <returns></returns>
        bool Delete();

        /// <summary>
        /// 修改转发规则(当前账户)
        /// </summary>
        /// <param name="updateDto"></param>
        /// <returns></returns>
        RelayDto Update(RelayDto updateDto);

        /// <summary>
        /// 获取转发规则(当前账户)
        /// </summary>
        /// <returns></returns>
        RelayDto Get();

        /// <summary>
        /// 获取转发规则
        /// </summary>
        /// <returns></returns>
        RelayDto GetByCompanyId(int companyId);
        /// <summary>
        /// 获取全部转发规则
        /// </summary>
        /// <returns></returns>
        List<RelayDto> GetAll();

        /// <summary>
        /// 发送转发服务控制命令
        /// </summary>
        /// <param name="relayServerRunState"></param>
        /// <returns></returns>
        bool SendControlCmd(RelayServerRunState relayServerRunState);

        /// <summary>
        /// 获取新命令
        /// </summary>
        /// <returns></returns>
        List<RelayDto> GetNewCommond();
        List<RelayDto> GetRunningCommond();

        /// <summary>
        /// 修改命令状态
        /// </summary>
        /// <param name="companyId"></param>
        /// <param name="relayControlCmdState"></param>
        /// <returns></returns>
        bool SetCmdRunState(int companyId, RelayControlCmdState relayControlCmdState);

        /// <summary>
        /// 修改服务运行状态
        /// </summary>
        /// <param name="companyId"></param>
        /// <param name="relayServerRunState"></param>
        /// <returns></returns>
        bool SetServerRunState(int companyId, RelayServerRunState relayServerRunState);


        /// <summary>
        /// 写入错误消息
        /// </summary>
        /// <param name="companyId"></param>
        /// <param name="ErrorMsg"></param>
        /// <returns></returns>
        bool SetLastError(int companyId, string ErrorMsg);
    }
}